package cn.tedu.tmall.admin.content.pojo.param;

import io.swagger.annotations.ApiModelProperty;
import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 * 增加分类入参
 */
@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
public class CategoryAddParam implements Serializable {

    @ApiModelProperty(
            required = true,
            example = "经验",
            dataType = "String")
    @NotNull(message = "类别名称不能为空-byNull")  //不能为空 null
    @NotBlank(message = "类别名称不能为空-byBlank") //"   " ,null 也能验证 "" 也能验证
    @NotEmpty(message = "类别名称不能为空-byEmpty") // 字符串和容器
    @Size(min = 1,max = 5,message = "类别名称不能太长-BySize") //字符串和容器
    @Length(min = 1,max = 5,message = "类别名称不能太长-ByLength") //字符串
    // 数字 年龄 18-120 怎么去验证 ...
    String name;

    /**
     * age是为了测试用
     */
    @Range(min = 18,max = 120,message = "年龄应该在18-120之间") //数字,不是长度是数字的范围
    Integer age;

}
